home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / PictUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  8.7 KB  |  211 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        PictUtils.h
  3.  
  4.      Contains:    Picture Utilities Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1990-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __PICTUTILS__
  19. #define __PICTUTILS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __PALETTES__
  25. #include <Palettes.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50. /* verbs for the GetPictInfo, GetPixMapInfo, and NewPictInfo calls */
  51.  
  52. enum {
  53.     returnColorTable            = 0x0001,
  54.     returnPalette                = 0x0002,
  55.     recordComments                = 0x0004,
  56.     recordFontInfo                = 0x0008,
  57.     suppressBlackAndWhite        = 0x0010
  58. };
  59.  
  60.  
  61. enum {
  62.                                                                 /* color pick methods */
  63.     systemMethod                = 0,                            /* system color pick method */
  64.     popularMethod                = 1,                            /* method that chooses the most popular set of colors */
  65.     medianMethod                = 2,                            /* method that chooses a good average mix of colors */
  66.                                                                 /* color bank types */
  67.     ColorBankIsCustom            = -1,
  68.     ColorBankIsExactAnd555        = 0,
  69.     ColorBankIs555                = 1
  70. };
  71.  
  72. typedef long                             PictInfoID;
  73. struct CommentSpec {
  74.     short                             count;                        /* number of occurrances of this comment ID */
  75.     short                             ID;                            /* ID for the comment in the picture */
  76. };
  77. typedef struct CommentSpec CommentSpec;
  78.  
  79. typedef CommentSpec *                    CommentSpecPtr;
  80. typedef CommentSpecPtr *                CommentSpecHandle;
  81. struct FontSpec {
  82.     short                             pictFontID;                    /* ID of the font in the picture */
  83.     short                             sysFontID;                    /* ID of the same font in the current system file */
  84.     long                             size[4];                    /* bit array of all the sizes found (1..127) (bit 0 means > 127) */
  85.     short                             style;                        /* combined style of all occurrances of the font */
  86.     long                             nameOffset;                    /* offset into the fontNamesHdl handle for the font’s name */
  87. };
  88. typedef struct FontSpec FontSpec;
  89.  
  90. typedef FontSpec *                        FontSpecPtr;
  91. typedef FontSpecPtr *                    FontSpecHandle;
  92. struct PictInfo {
  93.     short                             version;                    /* this is always zero, for now */
  94.     long                             uniqueColors;                /* the number of actual colors in the picture(s)/pixmap(s) */
  95.     PaletteHandle                     thePalette;                    /* handle to the palette information */
  96.     CTabHandle                         theColorTable;                /* handle to the color table */
  97.     Fixed                             hRes;                        /* maximum horizontal resolution for all the pixmaps */
  98.     Fixed                             vRes;                        /* maximum vertical resolution for all the pixmaps */
  99.     short                             depth;                        /* maximum depth for all the pixmaps (in the picture) */
  100.     Rect                             sourceRect;                    /* the picture frame rectangle (this contains the entire picture) */
  101.     long                             textCount;                    /* total number of text strings in the picture */
  102.     long                             lineCount;                    /* total number of lines in the picture */
  103.     long                             rectCount;                    /* total number of rectangles in the picture */
  104.     long                             rRectCount;                    /* total number of round rectangles in the picture */
  105.     long                             ovalCount;                    /* total number of ovals in the picture */
  106.     long                             arcCount;                    /* total number of arcs in the picture */
  107.     long                             polyCount;                    /* total number of polygons in the picture */
  108.     long                             regionCount;                /* total number of regions in the picture */
  109.     long                             bitMapCount;                /* total number of bitmaps in the picture */
  110.     long                             pixMapCount;                /* total number of pixmaps in the picture */
  111.     long                             commentCount;                /* total number of comments in the picture */
  112.     long                             uniqueComments;                /* the number of unique comments in the picture */
  113.     CommentSpecHandle                 commentHandle;                /* handle to all the comment information */
  114.     long                             uniqueFonts;                /* the number of unique fonts in the picture */
  115.     FontSpecHandle                     fontHandle;                    /* handle to the FontSpec information */
  116.     Handle                             fontNamesHandle;            /* handle to the font names */
  117.     long                             reserved1;
  118.     long                             reserved2;
  119. };
  120. typedef struct PictInfo PictInfo;
  121.  
  122. typedef PictInfo *                        PictInfoPtr;
  123. typedef PictInfoPtr *                    PictInfoHandle;
  124. typedef CALLBACK_API( OSErr , InitPickMethodProcPtr )(SInt16 colorsRequested, UInt32 *dataRef, SInt16 *colorBankType);
  125. typedef STACK_UPP_TYPE(InitPickMethodProcPtr)                     InitPickMethodUPP;
  126. enum { uppInitPickMethodProcInfo = 0x00000FA0 };                 /* pascal 2_bytes Func(2_bytes, 4_bytes, 4_bytes) */
  127. #define NewInitPickMethodProc(userRoutine)                         (InitPickMethodUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppInitPickMethodProcInfo, GetCurrentArchitecture())
  128. #define CallInitPickMethodProc(userRoutine, colorsRequested, dataRef, colorBankType)  CALL_THREE_PARAMETER_UPP((userRoutine), uppInitPickMethodProcInfo, (colorsRequested), (dataRef), (colorBankType))
  129. typedef CALLBACK_API( OSErr , RecordColorsProcPtr )(UInt32 dataRef, RGBColor *colorsArray, SInt32 colorCount, SInt32 *uniqueColors);
  130. typedef STACK_UPP_TYPE(RecordColorsProcPtr)                     RecordColorsUPP;
  131. enum { uppRecordColorsProcInfo = 0x00003FE0 };                     /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  132. #define NewRecordColorsProc(userRoutine)                         (RecordColorsUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppRecordColorsProcInfo, GetCurrentArchitecture())
  133. #define CallRecordColorsProc(userRoutine, dataRef, colorsArray, colorCount, uniqueColors)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppRecordColorsProcInfo, (dataRef), (colorsArray), (colorCount), (uniqueColors))
  134. typedef CALLBACK_API( OSErr , CalcColorTableProcPtr )(UInt32 dataRef, SInt16 colorsRequested, void *colorBankPtr, CSpecArray resultPtr);
  135. typedef STACK_UPP_TYPE(CalcColorTableProcPtr)                     CalcColorTableUPP;
  136. enum { uppCalcColorTableProcInfo = 0x00003EE0 };                 /* pascal 2_bytes Func(4_bytes, 2_bytes, 4_bytes, 4_bytes) */
  137. #define NewCalcColorTableProc(userRoutine)                         (CalcColorTableUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalcColorTableProcInfo, GetCurrentArchitecture())
  138. #define CallCalcColorTableProc(userRoutine, dataRef, colorsRequested, colorBankPtr, resultPtr)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppCalcColorTableProcInfo, (dataRef), (colorsRequested), (colorBankPtr), (resultPtr))
  139. typedef CALLBACK_API( OSErr , DisposeColorPickMethodProcPtr )(UInt32 dataRef);
  140. typedef STACK_UPP_TYPE(DisposeColorPickMethodProcPtr)             DisposeColorPickMethodUPP;
  141. enum { uppDisposeColorPickMethodProcInfo = 0x000000E0 };         /* pascal 2_bytes Func(4_bytes) */
  142. #define NewDisposeColorPickMethodProc(userRoutine)                 (DisposeColorPickMethodUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDisposeColorPickMethodProcInfo, GetCurrentArchitecture())
  143. #define CallDisposeColorPickMethodProc(userRoutine, dataRef)     CALL_ONE_PARAMETER_UPP((userRoutine), uppDisposeColorPickMethodProcInfo, (dataRef))
  144. EXTERN_API( OSErr )
  145. GetPictInfo                        (PicHandle                 thePictHandle,
  146.                                  PictInfo *                thePictInfo,
  147.                                  short                     verb,
  148.                                  short                     colorsRequested,
  149.                                  short                     colorPickMethod,
  150.                                  short                     version)                            THREEWORDINLINE(0x303C, 0x0800, 0xA831);
  151.  
  152. EXTERN_API( OSErr )
  153. GetPixMapInfo                    (PixMapHandle             thePixMapHandle,
  154.                                  PictInfo *                thePictInfo,
  155.                                  short                     verb,
  156.                                  short                     colorsRequested,
  157.                                  short                     colorPickMethod,
  158.                                  short                     version)                            THREEWORDINLINE(0x303C, 0x0801, 0xA831);
  159.  
  160. EXTERN_API( OSErr )
  161. NewPictInfo                        (PictInfoID *            thePictInfoID,
  162.                                  short                     verb,
  163.                                  short                     colorsRequested,
  164.                                  short                     colorPickMethod,
  165.                                  short                     version)                            THREEWORDINLINE(0x303C, 0x0602, 0xA831);
  166.  
  167. EXTERN_API( OSErr )
  168. RecordPictInfo                    (PictInfoID             thePictInfoID,
  169.                                  PicHandle                 thePictHandle)                        THREEWORDINLINE(0x303C, 0x0403, 0xA831);
  170.  
  171. EXTERN_API( OSErr )
  172. RecordPixMapInfo                (PictInfoID             thePictInfoID,
  173.                                  PixMapHandle             thePixMapHandle)                    THREEWORDINLINE(0x303C, 0x0404, 0xA831);
  174.  
  175. EXTERN_API( OSErr )
  176. RetrievePictInfo                (PictInfoID             thePictInfoID,
  177.                                  PictInfo *                thePictInfo,
  178.                                  short                     colorsRequested)                    THREEWORDINLINE(0x303C, 0x0505, 0xA831);
  179.  
  180. EXTERN_API( OSErr )
  181. DisposePictInfo                    (PictInfoID             thePictInfoID)                        THREEWORDINLINE(0x303C, 0x0206, 0xA831);
  182.  
  183. #if OLDROUTINENAMES
  184. #define DisposPictInfo(thePictInfoID) DisposePictInfo(thePictInfoID)
  185. #endif  /* OLDROUTINENAMES */
  186.  
  187.  
  188.  
  189.  
  190.  
  191. #if PRAGMA_STRUCT_ALIGN
  192.     #pragma options align=reset
  193. #elif PRAGMA_STRUCT_PACKPUSH
  194.     #pragma pack(pop)
  195. #elif PRAGMA_STRUCT_PACK
  196.     #pragma pack()
  197. #endif
  198.  
  199. #ifdef PRAGMA_IMPORT_OFF
  200. #pragma import off
  201. #elif PRAGMA_IMPORT
  202. #pragma import reset
  203. #endif
  204.  
  205. #ifdef __cplusplus
  206. }
  207. #endif
  208.  
  209. #endif /* __PICTUTILS__ */
  210.  
  211.